﻿// -----------------------------------------------------------------------
// <copyright file="StateModel.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace RRSync.Lib.Models
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.Serialization;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    [Serializable]
    public class FileStateModel : ISerializable
    {
        private const string HASH_NAME = "Hash";
        private const string LAST_MODIFIED_NAME = "LastModified";

        public FileStateModel()
        {
        }

        public FileStateModel(SerializationInfo info, StreamingContext context)
            : this()
        {
            this.Hash = (string)info.GetValue(HASH_NAME, typeof(string));
            this.LastModified = (DateTime)info.GetValue(LAST_MODIFIED_NAME, typeof(DateTime));
        }

        public string Hash { get; set; }
        public DateTime LastModified { get; set; }
        public Guid TokenProcess { get; set; }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue(HASH_NAME, this.Hash);
            info.AddValue(LAST_MODIFIED_NAME, this.LastModified);
        }
    }
}
